<template>
  <div class="user-profile">
    <h2>个人信息</h2>
    <div class="user-header">
      <el-avatar class="user-avatar" :src="user.avatar" :size="80"></el-avatar>
    </div>
    <el-descriptions title="用户详情" :column="1" border>
      <el-descriptions-item label="姓名">{{ user.name }}</el-descriptions-item>
      <el-descriptions-item label="性别">{{ user.gender }}</el-descriptions-item>
      <el-descriptions-item label="年龄">{{ user.age }}</el-descriptions-item>
      <el-descriptions-item label="联系方式">{{ user.contact }}</el-descriptions-item>
    </el-descriptions>
    <div class="button-container">
      <el-button type="primary" @click="handleEditPassword">修改密码</el-button>
      <el-button type="primary" @click="outPut">退出登录</el-button>
    </div>
  </div>
</template>

<script>
import logo from '@/assets/logo.png'
export default {
  data() {
    return {
      user: {
        name: 'user1',
        gender: '女',
        age: '21',
        contact: 'XXXXXXXXX@163.com',
        avatar: logo
      }
    };
  },
  methods: {
    handleEditPassword() {
      // 打开修改密码的弹框或跳转至修改密码页面
      // 在这里编写具体的逻辑
    },
    outPut(){

    }
  }
};
</script>

<style>
.user-profile {
  margin: 20px;
}

.user-header {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}

.user-avatar {
  border: 2px solid #fff;
}

.button-container {
  display: flex;
  justify-content: center;
  margin-top: 20px;
}
</style>
